<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>文档列表 - threeGroup(Light Year Admin)后台管理系统模板</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,threeGroup,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<link rel="stylesheet" href="js/jquery-tags-input/jquery.tagsinput.min.css">
<link href="css/style.min.css" rel="stylesheet">
</head>
  <style>
    .col-lg-12{
      margin: auto;
    top: 17px;
    left: 0;
    bottom: 0;
    right: 0;
    position: absolute;
    }
  </style>
<body>


<div class="lyear-layout-web"  id="app">
  <div class="lyear-layout-container">
    <!--左侧导航-->

    <!--End 左侧导航-->
    
    <!--头部信息-->
 
    <!--End 头部信息-->
    
    <!--页面主要内容-->

    <main class="lyear-layout-content" >
      <div class="container-fluid">
        
        <div class="row">
          <div class="col-lg-12" >
            <div class="card">
              <div class="card-toolbar clearfix">
                <form class="pull-right search-bar" method="get" action="#!" role="form">
                  <div class="input-group">
                    <div class="input-group-btn">
                      <input type="hidden" name="search_field" id="search-field" value="title">
                      <button class="btn btn-default dropdown-toggle" id="search-btn" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">
                      标题 <span class="caret"></span>
                      </button>
                      <ul class="dropdown-menu">
                        <li> <a tabindex="-1" href="javascript:void(0)" data-field="title">题名</a> </li>
                      </ul>
                    </div>
                    <input type="text" class="form-control" value="" name="keyword" placeholder="请输入名称" v-model="resource.title" v-on:keyup="getlist(1)">
                  </div> 
                </form>
                <div class="toolbar-btn-action">
                  <!-- <a class="btn btn-primary m-r-5" href="#!"><i class="mdi mdi-plus"></i> 新增</a>
                  <a class="btn btn-success m-r-5" href="#!"><i class="mdi mdi-check"></i> 启用</a>
                  <a class="btn btn-warning m-r-5" href="#!"><i class="mdi mdi-block-helper"></i> 禁用</a>
                  <a class="btn btn-danger" href="#!"><i class="mdi mdi-window-close"></i> 删除</a> -->
                  <a class="btn btn-primary m-r-5" type="button" @click="exportExcel3()"><i class="mdi mdi-plus"></i>导出</a>
                  <a class="btn btn-xs btn-default"  type="button" data-toggle="modal" @click="dao()" data-toggle="tooltip">导入</a>
                </div>
              </div>
              <div class="card-body"> 
                <div class="table-responsive" v-loading="loading" element-loading-text="拼命加载中"></div>
                <div class="table-responsive">
                  <table class="table table-bordered">
                    <thead>
                      <tr>
                        <th></th>
                        <th>
                          <label class="lyear-checkbox checkbox-primary">
                            <input type="checkbox" id="check-all"><span></span>
                          </label>
                        </th>
                        <th>题名</th>
                        <th>订购号</th>
                        <th>PISSN</th>
                        <th>BISSN</th>
                        <th>PISBN</th>
                        <th>EISBN</th>
                        <th>出版社</th>
                        <th>订购单位</th>
                        <th>套题名</th>
                        <th>文件类型</th>
                        <th>审核状态</th>
                        <th>操作</th>
                      </tr>
                    </thead>
                    <tbody>
                      <tr v-for="(item,index) in list">
                        <td>{{item.id}}</td>
                        <td>
                          <label class="lyear-checkbox checkbox-primary">
                            <input type="checkbox" name="ids[]" value="1"><span></span>
                          </label>
                        </td>  
                        <td>{{item.title}}</td>
                        <td>{{item.orderNumber}}</td>
                        <td>{{item.pissn}}</td>
                        <td>{{item.eissn}}</td>
                        <td>{{item.pisbn}}</td>
                        <td>{{item.eisbn}}</td>
                        <td>{{item.publisher}}</td>
                        <td v-for="(it1,index) in item.organs">
                          {{it1.name}}
                        </td>
                        <td v-for="(it,index) in item.covers">
                            {{it.coverName}}
                        </td>
                        <td>{{item.type}}</td>
                        <td v-if="item.reviewStatus==0">待审核</td>
                        <td v-if="item.reviewStatus==1">审核中</td>
                        <td v-if="item.reviewStatus==2">审核通过</td>
                        <td v-if="item.reviewStatus==3">审核未通过</td>
                       
                        <td>
                          <!-- <div class="btn-group">
                            <a class="btn btn-xs btn-default" href="#!" title="编辑" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>
                            <a class="btn btn-xs btn-default" href="#!" title="删除" data-toggle="tooltip"><i class="mdi mdi-window-close"></i></a>
                          </div> -->
                          <a class="btn btn-xs btn-default" @click="update(item.id)"  type="button" data-toggle="modal" data-target="#myModal2" title="编辑" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>
                          <!-- <a class="btn btn-xs btn-default" href="#!" data-toggle="tooltip" @click="">导出</a> -->

                        </td>
                      </tr>
                    </tbody>
                  </table>
                </div>
                </div>
                <nav>
                  <ul class="pagination pagination-circle">
                   <li class="active"><a>{{totals}}</a></li>
                   <li>
                     <a type="button" @click="getlist(prePage)">
                       <span><i class="mdi mdi-chevron-left" ></i></span>
                     </a>
                   </li>
                   <li ><a>{{page}}</a></li>
                   <li>
                     <a type="button" @click="getlist(nextPage)">
                       <span><i class="mdi mdi-chevron-right"></i></span>
                     </a>
                   </li>
                 </ul> 
               </nav>
                <!-- 导入 -->
                <!-- <form  action=""  class="form-horizontal" role="form">
                  <div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                  <div class="modal-dialog">
                    <div class="modal-content">
                      <div class="modal-header">
                        <h4 class="modal-title" id="myModalLabel">
                            导入文件
                        </h4>  
                        <div>
                            <input type="file">
                        </div>
                        <div class="modal-footer">
                          <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                          <input type="button" data-dismiss="modal" class="btn btn-primary" @click="add()" value="提交">
                      </div>
                    </div>
                    </div>
                  </div>
                </div>
                </form> -->
                <form action="" class="form-horizontal" role="form">
                 <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-content">
                      <div class="modal-header">
                        <h4 class="modal-title" id="myModalLabel">
                            资源信息回显
                        </h4>
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                            &times;
                        </button>
                    </div>
                    <div class="modal-body" style="height: 100%;">
                      <div class="form-group">
                        <label for="lastname" class="col-sm-3 control-label">题名</label>
                        <div class="col-sm-7">
                          <input class="form-control" type="text" v-model="resource.title" placeholder="题名">
                        </div>
                      </div>
                      <div class="form-group">
                        <label for="lastname" class="col-sm-3 control-label">订购号</label>
                        <div class="col-sm-7">
                          <input class="form-control" type="text" v-model="resource.orderNumber" placeholder="订购号">
                        </div>
                      </div>
                      <div class="form-group">
                        <label for="lastname" class="col-sm-3 control-label">PISSN</label>
                        <div class="col-sm-7">
                          <input class="form-control" type="text" v-model="resource.pissn" placeholder="PISSN">
                        </div>
                      </div>
                      <div class="form-group">
                        <label for="lastname" class="col-sm-3 control-label">EISSN</label>
                        <div class="col-sm-7">
                          <input class="form-control" type="text" v-model="resource.eissn" placeholder="EISSN">
                        </div>
                      </div>
                      <div class="form-group">
                        <label for="lastname" class="col-sm-3 control-label">PISBN</label>
                        <div class="col-sm-7">
                          <input class="form-control" type="text" v-model="resource.pisbn" placeholder="PISBN">
                        </div>
                      </div>
                      <div class="form-group">
                        <label for="lastname" class="col-sm-3 control-label">EISBN</label>
                        <div class="col-sm-7">
                          <input class="form-control" type="text" v-model="resource.eisbn" placeholder="EISBN">
                        </div>
                      </div>
                      <div class="form-group">
                        <label for="lastname" class="col-sm-3 control-label">出版社</label>
                        <div class="col-sm-7">
                          <input class="form-control" type="text" v-model="resource.publisher" placeholder="出版社">
                        </div>
                      </div>
                      <div class="form-group">
                        <label for="lastname" class="col-sm-3 control-label">订购单位</label>
                        <div class="col-sm-7">
                          <input class="form-control" type="text" v-model="organ.organName" placeholder="订购单位">
                        </div>
                      </div>
                      <div class="form-group">
                        <label for="lastname" class="col-sm-3 control-label">套题名</label>
                        <div class="col-sm-7">
                          <input class="form-control" type="text" v-model="cover.coverName" placeholder="套题名">
                        </div>
                      </div>
                      <div class="form-group">
                        <label for="lastname" class="col-sm-3 control-label">文件类型</label>
                        <div class="col-sm-7">
                          全部<input  type="radio" v-model="resource.type" style="margin-left: 6px" value="全部">
                          期刊<input  type="radio" v-model="resource.type" style="margin-left: 6px" value="期刊">
                          非刊<input  type="radio" v-model="resource.type" style="margin-left: 6px" value="非刊">
                        </div>
                      </div>
                      <!-- <div class="form-group">
                        <label for="lastname" class="col-sm-3 control-label">审核状态</label>
                        <div class="col-sm-7">
                          <input class="form-control" type="text" v-model="resource.reviewStatus" placeholder="审核状态">
                        </div>
                      </div> -->
                    </div>
                    <div class="modal-footer">
                      <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                      <!-- <input type="button" data-dismiss="modal"  class="btn btn-primary" @click="userupdate()" value="提交"/> -->
                      <input type="button" data-dismiss="modal" class="btn btn-primary" @click="add()" value="提交">
                   </div>
                  </div>
                 </div>
                </form>
              </div>
            </div>
          </div>
          
        </div>
        
      </div>
      
    </main>
    <!--End 页面主要内容-->
  </div>
</div>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/perfect-scrollbar.min.js"></script>
<!-- <script type="text/javascript" src="js/main.min.js"></script> -->
<script src="https://cdn.bootcss.com/vue/2.6.9/vue.min.js"></script>
<script src="https://cdn.bootcss.com/axios/0.19.0/axios.min.js"></script>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
    $('.search-bar .dropdown-menu a').click(function() {
        var field = $(this).data('field') || '';
        $('#search-field').val(field);
        $('#search-btn').html($(this).text() + ' <span class="caret"></span>');
    });
});
</script>
</body>

<script>
  new Vue({
    el:"#app",
    data:{
      list:[],
      organs:[],
      loading: false,
      size:5, 
      page:1,
      totals:0,
      prePage:1,
      nextPage:1,
      totalPage:1, //总页数
      resource:{

      },
      cover:{},
      organ:{},
      resourceupdate:{},
      wid:""
    },
    created () {
        this.getlist();
    },
    methods: {
      getlist(){
        axios.post("http://29n01o8660.oicp.vip/smaintenance/list/").then(msg=>{
          console.log(msg);
          this.list=msg.data;
          // this.totals = msg.data.total;
          // this.page=page;
          // this.totalPage =Math.ceil(this.totals/this.size);
          // this.prePage = page>1?page-1:page;
          // this.nextPage = page<this.totalPage?page+1:page;
        })
      },
      update(wid){
          window.localStorage.setItem("wid",wid);
         
          axios.get("http://29n01o8660.oicp.vip/smaintenance/findById/"+wid).then(msg=>{
            console.log(msg);
            this.resource=msg.data;
          })
      },
      add(){
        axios.post('http://29n01o8660.oicp.vip/smaintenance/updateAdd',this.resource).then(msg=>{
          console.log(msg);
          alert("添加成功");
        })
      },
      exportExcel3(){
          location.href="http://29n01o8660.oicp.vip/smaintenance/queryDevied";
      },
      dao(){
        axios.get('http://29n01o8660.oicp.vip/smaintenance/importResource').then(msg=>{
          console.log(msg);
          this.list=msg.data;
        })
      }
    }
  })
</script>
</html>